package com.tanhua.dubbo.api;

import com.tanhua.model.mongo.TestResult;
import org.apache.dubbo.config.annotation.DubboService;
import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;

@DubboService
public class testResultApiImpl implements TestResultApi {
    @Autowired
    MongoTemplate mongoTemplate;

    @Override
    public TestResult testreport(String id) {
        return mongoTemplate.findOne(Query.query(Criteria.where("id").is(new ObjectId(id))), TestResult.class);
    }
}
